// Ajax form upload
function uploadImage() {
	// Open
	$('#openDialog').click();
}

var optionsUpload = {
		complete : function(response) {
			response.responseText = response.responseText.replace("<PRE>", "");
			response.responseText = response.responseText.replace("</PRE>", "");
			response.responseText = response.responseText.replace("<pre>", "");
			response.responseText = response.responseText.replace("</pre>", "");
			var json = eval('(' + response.responseText + ')');
			console.log(json);
				$("#image").empty();
				$("#image")
						.append(
								'<img src="imagesUserUploaded_tmp/'
										+ json.fileName
										+ '" width="280px" />'
										+ '<input type="hidden" name="itemImage" value="'
										+ json.fileName + '" />');
			
		},
		error : function() {

		}

	};
	$('#openDialog').live('change', function() {
		$("#formUpload").ajaxForm(optionsUpload).submit();
	});